package net.googlecode.exigenlab.task5.calculator;

import net.googlecode.exigenlab.task5.model.Employee;
import net.googlecode.exigenlab.task5.model.Manager;

import java.math.BigDecimal;

/**
 * Class for calculating salary for Employee
 */
public class EmployeeSalaryCalculator extends ManagerSalaryCalculator {
    @Override
    public BigDecimal calculateMonthRate(Manager person) {
        BigDecimal rate = person.getRate() != null ? person.getRate() : BigDecimal.ZERO;
        return rate.multiply(new BigDecimal(((Employee) person).getYearOfExperience()));
    }
}
